Parallel Implementation of RSA Algorithm using OpenMP and Analysis of Speedup

 

Nutan Singh, Mukesh Kashyap, Sanjay Kumar, V. K. Patle

SoS in Computer Science & IT Pt.Ravishankar Shukla University, Raipur, Chhattisgarh, India

*Corresponding Author E-mail: nutanmaic@gmail.com, Kashyapmukesh86@gmail.com, sanraipur@rediffmail.com, Patlevinod@gmail.com

 

ABSTRACT:

Nowadays data driven and digitally connected world, in computer science security is most importance era. The computer security relies on cryptographic security techniques for protection of data. RSA is one of the most used cryptographic algorithms, that based on asymmetric encryption algorithm used to maintain confidentiality and integrity of data. which can be speed up using parallelization of RSA encryption and decryption. This paper focuses on parallel implementation of RSA using OpenMP programming (OMP) Model. parallel implementations of the RSA algorithm. The parallel implementation utilizes the OpenMP library in a high-performance computing environment, To provide a robust analysis, the study makes use of a High Performance Computing environment to depict results for different Size in terms of sequential and parallel processing. Through experimental analysis, the implementation is shown to have greatly improved execution times when compared against sequential implementation. Then, the results are analyzed mainly for the speed up.

 

KEYWORDS: Multi core, RSA, Encryption, Decryption, Key, OpenMP, Parallel, Cipher.

 


I. INTRODUCTION:

The goal of cryptographic algorithms is to securely transmit data along open channels of communication while preserving the CIA triad (confidentiality, integrity, availability) of informational resources, including information content and telecommunication data)[11]. It also includes RSA algorithm and its implementation in sequential and parallel with varying different parameters. Cryptography[1] is an important area to encrypt messages using various encryption algorithms and also retrieving the actual message using same or different decryption algorithms. The two main types of cryptography algorithms are: Symmetric Encryption and Asymmetric cryptography.

 

A. Symmetric Encryption: Symmetric encryption consists of one of key for encryption and decryption.

 

Fig. 1. Symmetric Encryption Process

 

B. Asymmetric Encryption: Asymmetric Encryption consists of two cryptographic keys known as Public Key and Private Key.

 

Fig. 2. Asymmetric Key Cryptography Process.

 

II. ASYMMETRIC RSA ALGORITHM:

RSA was initially developed in 1977 by Rivest, Shamir, and Adlema[1] and is among the most critical algorithms applied in the authentication and encryption of data for secure transmission on open networks. RSA represents the critical public-key cryptographic structure that is utilised in multiple online applications, including ecommerce and credit card processing over networks, key exchanges, and digital signatures. The RSA algorithmic method is considered to be slower than symmetric-key algorithmic methods for it relies on modular exponentiations. key systems that are available. Therefore, multiple solutions were recommended to quicken RSA decryption, particularly when dealing with huge files. One of them is parallel computers and algorithmic methods.

 

Where RSA is used to decrypt cipher text and generate signatures, additional computing capacity and time is typically needed. RSA features a very high computing burden in comparison to the numerous and very fast private

 

A. Concepts used in Cryptography:

a.     Plain Text: The original message that the person want to communicate is defined as plain text.

b.     Cipher Text: The message which cannot be understood by anyone is defined as cipher text.

c.     Encryption: To encrypt a message using RSA, firstly the message should be segmented into integers 0 𝑚2𝑛−1, i.e. 𝑛−1 bits length, then performing the equation:

𝒄=𝒎

𝒆𝒎𝒐

𝒅𝒏

d.     Decryption: Converting cipher text to plain text is referred as decryption. Thus, 𝑐 represents the encrypted message which is 𝑛 bits in length. However, to retrieve the original message 𝑚 from the encrypted message 𝑐, this calculation should be performed:

𝒎=𝒄

𝒅𝒎

e.     Key: Combination of numeric or alpha numeric text or special symbol is referred as key.it may use at time of encryption or decryption. key plays a vital role in cryptography because encryption algorithm directly depends on it.

 

The RSA algorithm can be summarized in the following steps[9].

Step 1: Enter two large prime's p and q of approximately the large size.

Step 2: Calculate the modulus n = p*q. and Calculate: φ (n)

= (p-1) (q-1); Where φ (n) represents the Euler Totient function.

Step 3: Choose a random encryption exponent e less than n such that the GCD (φ (n), e) =1, 1<e< φ (n).

Step 4: Calculate the decryption exponent d using The Extended Euclidean algorithm: d. e = 1 mod φ (n). Which d is the multiplicative inverse of e modulo φ (n).

Step 5: The encryption function is: E (M) = Me mod n.

Step 6: The decryption function is: D (C) = Cd mod n.

Step 7: The RSA keys are: The public key is (n, e), and the private key is (p, q, d).

 

RSA encryption applies in terms of the factorization of very large numbers.

 

Fig. 3. Flow chart of RSA Algorithm[5].

 

This section is an introductory framework that explains the basic operation of the RSA algorithm and the OpenMP programming model.

 

Key Generation:

The key generation phase is a very crucial part of the RSA algorithm. It consists of the following steps:

1.     Pick two large random prime numbers p and q.

2.     Find the modulus (n) = p × q. 3. Find phi = (p-1) × (q-1).

3.     Pick an integer value e that falls in the range (1, phi) such that GCD (e, phi) =1 where GCD stands for the Greatest Common Divisor. In RSA, e is known as the public or encryption exponent.

4.     Find an integer value d that falls in the range (1, phi) such that e × d = 1 mod phi. In RSA, d is referred to as the private or decryption exponent.

 

According to the RSA operation, the public key consists of n and e while the private key consists of m and d.

 

Data Encryption:

The encryption process works according to the following equation:

C= Me mod n

Such that:     - C is the cipher text

- M is the plain text.

 

Data Decryption:

The decryption process works according to the following equation:

M = Cd mod n

 

III. METHODOLOGY:

A. Experimental Tool:

OpenMp:

OpenMP “Open multiprocessing” is API for application that uses shared memory. OpenMP is a portable Application Programming Interface (API) that can be used to create shared memory parallel programs. It is portable, user friendly and efficient. It was first released in 1957[2]. It is an API for writing multithreaded applications. It is a set of compiler directives and library routines for parallel application programmers. Using OpenMP, the programmer can write code that will be able to use all cores of a multicore computer and will be run faster if the number of cores is increased. it is used in shared memory architecture. In general, Programs written using OpenMp depends on the number of created threads in by default equal to the number of cores, however, the user can set the number of threads to any particular value via the numerous interfaces provided by the OpenMP[2]. Moreover, OpenMP provides the user with the ability to choose the thread’s scheduling policy that will be used during program execution.

 

The experimental work conducted towards this research consists of three main steps including: RSA parallelization, performance evaluation and Speedup analysis. Each step will be thoroughly explained in the following sub-sections.

 

The OpenMP parallelization technique was based on the following two:

Steps:

i.      Creating a parallel region using the #pragma directive. The appropriate clauses (i.e. shared and private clauses) should also be set accordingly [15].

ii.    Using the #pragma omp for directive to specify the loop whose iterations should be executed in parallel.

 

To Compile and run :

Compile: gcc -o obj -fopenmp RSA.c Run:./obj

 

The same parallelization procedure can be applied on the decryption part of the RSA. For the rest of this paper, the serial and parallel versions of the RSA will be denoted as SRSA and PRSA respectively. Both SRSA and PRSA have been implemented using the C programming language and compiled using the GCC compiler on Fedora 31. They have been run on Intel Multicore processor. In this paper, CPU frequency scaling has been done manually using the CPUFreqUtils package provided by the Linux operating system [15]. For both SRSA and PRSA, several working set sizes i.e. NUM_MSGS have been tested. The working set include {100, 200, 300, 400 and 500} byte.

 

IV. EXPERIMENTAL RESULTS AND PERFORMANCE EVALUATION:

4.1  Encryption and Decryption Time Evaluation:

In this part, we show the experiment results for RSA with different length of character in byte for large value of n.

 

Table I. Comparison of encryption time for parallel and sequential for large prime number(413*328)

Length of character in byte

Encryption time for parallel

Encryption time for sequential

10 byte

0.002908

0.000206

100 byte

0.001288

0.001907

200 byte

0.001987

0.003742

300 byte

0.003329

0.005588

400 byte

0.003872

0.007458

500 byte

0.004073

0.009604

 

Fig. 4. The execution time in seconds for encryption for sequential and parallel with variant byte

 

Table II.         Decryption time of parallel and sequential

Length of character in Byte

Decryption time for parallel

Decryption time for Sequential

10 byte

0.037435

0.094533

100 byte

0.274483

0.941496

200 byte

0.546204

1.883515

300 byte

0.807425

2.826046

400 byte

1.092326

3.771117

500 byte

1.445444

4.711104

 

Fig. 5. The execution time in seconds for decryption for sequential and parallel with variant byte.

 

Table 1 shows the relationship between the amount of data inputting to the RSA algorithm and the execution times (in seconds). The first column shows the length of character in byte input to the algorithm, the second column shows the encryption time for parallel, and the third column shows the encryption time for sequential used to process the data input. In the above table. II shows decryption time are used to execute RSA. The execution time is calculated in seconds.

 

4.2  Speed up evaluation:

The speed up factor is a measure that captures the comparative benefit of solving a computational problem in parallel. The speed up factor of parallel computation operating on p processors is derived as the following ratio.

 

Speed Up, S =TS/TP Efficiency, E =S/p

Where TS is the run time of the sequence implementation, TP is the run time of the parallel implementation, and p is the number of processors [8]. These equations will be referred to when computing the speed up and efficiency of each parallel execution of the RSA algorithm [8].

 

Table III Total time taken in sequential and parallel

Length of charact er in bit

Total time in sequential

Total time in paralle l

Speedup

10 byte

0.094739

0.040343

2.34833800163

5972

100 byte

0.943403

0.275771

3.42096522114

363

200 byte

1.887257

0.548191

3.44269971597

4907

300 byte

2.831634

0.810754

3.49259331437

156

400 byte

3.778575

1.096198

3.44698220576

9396

500 byte

4.720708

1.449517

3.25674552281

898

 

 

Fig. 6. We measure two total time performance of sequential and parallel to illustrate our experimental findings: Speed Up. This enables us to compare how effective the parallelized approach is against the sequential approach.

 

Fig. 7. Speed Up.

 

In the above table III shows the length of character in byte input to the algorithm, the second column shows the total time for parallel, the third column shows the total time for sequential and fourth column shows the speed up calculation for process the different size of data input. and table. II shows decryption time are used to execute RSA. The execution time is calculated in seconds. Above results are calculated We have built our parallelized RSA encryption algorithm tool using the OpenMP library and run our experiments in the high-performance computing. The enhancement of the execution performance can be visually demonstrated by Figure 7.

 

V. CONCLUSION:

This paper presented the OpenMP based implementation of RSA algorithm. We described the traditional RSA cryptosystem. The large size of text and modular power function act as the bottleneck for performance.

We used Multi-core Architecture for parallel implementation of RSA. First, RSA was executed in CPU- only mode. Then, it was implemented in OpenMP in 10-byte, 100-byte, 200-byte, 300-byte, 400-byte and 500-byte modes. The results were compared which made it clear that higher the degree parallelism, better us the performance. It was a result overhead between Sequential and Parallel.

 

VI. REFERENCES:

1.      Da-Fang Zhang, Xia-An Bi Hong Zhang, "Comparison and Analysis of GPGPU and Parallel Computing on Multi-Core CPU, " vol. 2, pp. 185-187, 2012.

2.      Ms. Ashwini M. Bhugul, "Parallel Computing using OpenMP, " International Journal of Computer Science and Mobile Computing, Vol. 6, no. 2, pp. 90 – 94, February 2017.

3.      Supriya Gurpreet Singh, "A Study of Encryption Algorithms (RSA, DES, 3DES and AES) for Information Security, " International Journal of Computer Applications, pp. 33-38, 2013.

4.      S. Ranjitha Kumari B. Padmavathi, "A Survey on Performance Analysis of DES, AES and RSA Algorithm along with LSB Substitution Technique, " IJSR, pp. 170-174, 2013.

5.      Dr. Ajay Mathur, Dr. Swati Sharma Saurabh Khatri, "Parallel Implementation of Cryptographic algorithm for Image Encryption, " vol. 4, no. 2, pp. 424- 426, 2016.

6.      Susmita Dhang, Rupayan Das Punit Chaudhury, "ACAFP: Asymmetric Key based Cryptographic Algorithm using Four Prime Numbers to Secure Message Communication., " IEEE, pp. 332-337, 2017.

7.      Vishakha Vidhani Rishikesh Kadam, "Performance Analysis of RSA Algorithm with CUDA Parallel Computing, " IRJET, vol. 6, no. 5, pp. 6304-6307, may 2019.

8.      Zishan Ahmed Onik, Steven Smith Md. Ahsan Ayub, "Parallelized RSA Algorithm: An Analysis with Performance Evaluation using OpenMP Library in High Performance Computing Environmen, " International Conference of Computer and Information Technology, 2019.

9.      Mohammed Issam Younis Heba Mohammed Fadhil, "Parallelizing RSA Algorithm on Multicore CPU and GPU, " International Journal of Computer Applications, vol. 87, pp. 15-22, 2014.

10.   Kartik Sehgal, Amartya Tiwari, Abhishek Sharma, Ashish Joshi Abhishek Rawat, "A novel accelerated implementation of RSA using parallel processing, " Journal of Discrete Mathematical Sciences and Cryptography, vol. 22, pp. 309–322, 2019.

11.   Mohammad Qatawneh Areej Al-Shorman, "Performance of Parallel RSA on IMAN1 Supercomputer, " International Journal of Computer Applications, vol. 180, no. 37, pp. 31- 36, April 2018.

12.   S.R. Sathe Jitendra V. Tembhurne, "RSA Public Key Acceleration on CUDA GPU, " pp. 365-375, 2016.

13.   Yunfei Li Xuewen Tan, "Parallel Analysis of an Improved RSA Algorithm, " International Conference on Computer Science and Electronics Engineering, pp. 318-320, 2012.

14.   Chandra Segar Thirumalai, "Review on The Memory Efficient RSA Variants, " International Journal of Pharmacy & Technology, vol. 8, no. 4, pp. 4907 - 4916, 2016.

15.   Mutaz Al-Tarawneh, Ashraf Alkhresheh, “Towards An Optimal Multicore Processor Design for Cryptographic Algorithms – A Case Study on RSA” vol. 13, pp.54-77, 2014.

16.   Jaya Sharma Shilpi Gupta, "A Hybrid Encryption Algorithm based on RSA and Diffie-Hellman, " International Conference on Computational Intelligence and Computing Research, 2012.

 

 

Received on 21.05.2020            Accepted on 18.06.2020     

© EnggResearch.net All Right Reserved

Int. J. Tech. 2020; 10(1):77-82.

DOI: 10.5958/2231-3915.2020.00015.2